package com.fyzk.activity.lottery.jc.football.newJz;

import android.content.Intent;

import com.fyzk.activity.lottery.jc.football.JCInfo;
import com.fyzk.activity.lottery.jc.football.ZuCai_FenXiActivity;
import com.fyzk.activity.lottery.jc.football.adapter.JCZQ_BaseAdapter.OnJCZQAdapterClick;

import java.util.List;

public abstract class JC_BaseFragment extends JCZQFactorBaseFragment implements
		OnJCZQAdapterClick {

	protected final int REQUESTCODE_TAG = 0x11;
	public static final String RESULT_SPLIT_LQ = " ";

	@Override
	protected void adapterChange(List<JCInfo> infos) {
		// TODO Auto-generated method stub
		changCiNum = 0;
		for (JCInfo info : infos) {
			if (!info.getResult().equals(RESULT_MOREN)) {
				changCiNum++;
			}
		}
		btm_changCi.setText(changCiNum + "场");
	}

	/**
	 * 展开投注区
	 * @param position
	 */
	protected abstract void toZhanKai(int position);

	/**
	 * 计算 从投注区返回结果
	 * 
	 * @param infor
	 * @return
	 */
	protected String getResult(JCInfo infor) {
		String str = "";
		for (int i = 0; i < infor.getTouZhuInfor().size(); i++) {
			if (infor.getTouZhuInfor().get(i).isSelect()) {

				str += infor.getTouZhuInfor().get(i).getBiFen() + RESULT_SPLIT;
			}
		}
		if (!str.equals("")) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Override
	public void onClick_xiangXi() {
		// TODO Auto-generated method stub
		// position = (Integer) msg.obj;
		Intent intent = new Intent(getContext(),
				ZuCai_FenXiActivity.class);
		startActivity(intent);
	}

	@Override
	public void onClick_ZhanKai(int position) {
		// TODO Auto-generated method stub
		toZhanKai(position);
	}

	@Override
	public void onClick_ball(int position) {
		// TODO Auto-generated method stub
//		adapterChange(infos);
	}

}
